function [A, P, dimm, D, iD, C] = prepareAll(m, n, A0, lastIter)
%PREPAREP Summary of this function goes here
%   Detailed explanation goes here

dimm = cell(lastIter);
A = cell(lastIter);
P = cell(lastIter);
D = cell(lastIter);
iD = cell(lastIter);
C = cell(lastIter);

dimm{1} = [m, n];
A{1} = A0;
P{1} = prepareP2(m,n);
D{1} = diag(diag(A{1}),0);
iD{1} = inv(D{1});
C{1} = A{1} - D{1};

for i = 2:lastIter
    dimm{i} = floor(dimm{i-1}/2);
    P{i} = prepareP2(dimm{i}(1), dimm{i}(2));
    A{i} = P{i-1}'*A{i-1}*P{i-1};
    D{i} = diag(diag(A{i}),0);
    iD{i} = inv(D{i});
    C{i} = A{i} - D{i};
end

%P


end